﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="RetrievePwd.aspx.cs" Inherits="Account_RetrievePwd" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
    <style type="text/css">
        .input_line
        {
            line-height: 50px;
            clear: both;
        }
        .input_label
        {
            float: left;
            width: 130px;
            text-align: right;
        }
        .input_label_font
        {
            font-size: 12pt;
            font-weight: bold;
        }
        input[type="text"], input[type="password"]
        {
            width: 200px;
            height: 23px;
            font-size: 13pt;
            font-weight: bold;
            border: 1px solid #BCE9F1;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <div class="input_line">
        <div class="input_label">
            <label for="txtMail" class="input_label_font">
                注册邮箱：</label>
        </div>
        <div>
            <input id="txtMail" name="txtMail" type="text" runat="server" />
        </div>
        <div class="input_line">
            <div class="input_label">
                <label class="input_label_font" for="txtVerifyCode">
                    验证码：</label>
            </div>
            <div style="float: left;">
                <input id="txtVerifyCode" name="txtVerifyCode" maxlength="4" style="width: 60px;"
                    type="text" runat="server" />
                <div>
                    <img alt="验证码" title="点击切换图片" id="validImg" style="float: left; background-color: White;
                        vertical-align: middle;" /><div style="float: left; margin-left: 10px; line-height: 30px;">
                            验证码不区分大小写<br />
                            <a href="javascript:return void;" onclick="reloadVerifyCode();">看不清，换一张</a>
                        </div>
                    <input type="hidden" id="vCodeTempCache" value="" />
                </div>
                <script type="text/javascript">
                    var verifyCodeBaseUrl = "<%= PageHelper.Url("/account/VerifyCode.aspx?") %>";
                    var imgChangeCount = 1;
                    function reloadVerifyCode() {
                        imgChangeCount++;
                        if (imgChangeCount>10) {
                            return;
                        }
                        var newImgPath = verifyCodeBaseUrl + parseInt( Math.random()*10 );
                        $("#validImg").attr( "src", newImgPath );
                    }
                    $("#validImg").click( function () {
                        reloadVerifyCode();
                    });
                    reloadVerifyCode();
                </script>
            </div>
        </div>
        <div class="input_line" style="padding-left: 50px;">
            <button id="btnSubmit">
                找回密码</button>
        </div>
        <div class="input_line ui-state-highlight ui-corner-all" style="padding: 10px;">
            <div style="line-height: 22px;">
                <img alt="验证说明" src="../Images/register/mail_icon.gif" style="width: 32px; height: 22px;" />
                <label style="font-size: 14pt; font-weight: bold; color: gray;">
                    &nbsp;找回密码说明:</label>
            </div>
            <ul style="line-height: 22px;">
                <li>偷乐网将为您生成一个新的密码，密码并将其发送到您的电子邮箱。</li>
                <li>您查收邮件，并使用最新的密码登录偷乐网即可；如果你需要自己修改密码，请在登录后使用修改密码功能。</li>
            </ul>
        </div>
    </div>
    <script type="text/javascript">

        function checkVerifyCode() {
            var res = CommAjaxHelper.IsCorrectVerifyCode($("#MainContent_txtVerifyCode").val());
            return res.value;
        }
        $().ready(function () {

            $("#btnSubmit").button().click(function () {
                $("#Form1").sumbit();
            });

            $("#Form1").validate({
                rules: {
                    ctl00$MainContent$txtMail: {
                        required: true,
                        email: true,
                        customAjaxRemote: {
                            scope: ASP.account_retrievepwd_aspx,
                            method: ASP.account_retrievepwd_aspx.CheckEmailExists
                        }
                    },
                    ctl00$MainContent$txtVerifyCode: {
                        required: true,
                        minlength:4,
                        customMethod: {
                            scope: this,
                            method: checkVerifyCode
                        }
                    }
                },
                messages: {
                    ctl00$MainContent$txtMail: {
                        required: "请输入Email地址",
                        email: "Email地址不正确",
                        customAjaxRemote: "该Email地址还没有被注册"
                    },
                    ctl00$MainContent$txtVerifyCode: {
                        required: "请输入验证码",
                        minlength: 4,
                        customMethod: "验证码不正确"
                    }
                }
            });
        });
    </script>
</asp:Content>
